import 'package:inmotion_pro/pages/ble_search/FAQ/controller.dart';
import 'package:inmotion_pro/pages/ble_search/FAQ/view.dart';
import 'package:inmotion_pro/pages/ble_search/controller.dart';
import 'package:inmotion_pro/pages/ble_search/view.dart';
import 'package:inmotion_pro/pages/mine/contact_online_service/controller.dart';
import 'package:inmotion_pro/pages/mine/contact_online_service/view.dart';
import 'package:inmotion_pro/pages/login_register/area_code/controller.dart';
import 'package:inmotion_pro/pages/login_register/area_code/view.dart';
import 'package:inmotion_pro/pages/main/vehicle_more/controller.dart';
import 'package:inmotion_pro/pages/mine/setting/account_security/bind_3rd_account/controller.dart';
import 'package:inmotion_pro/pages/mine/app_about/controller.dart';
import 'package:inmotion_pro/pages/mine/app_about/view.dart';
import 'package:inmotion_pro/pages/mine/setting/account_security/remove_account/controller.dart';
import 'package:inmotion_pro/pages/mine/setting/account_security/remove_account/view.dart';
import 'package:inmotion_pro/pages/mine/user_info/controller.dart';
import 'package:inmotion_pro/pages/mine/user_info/view.dart';
import 'package:inmotion_pro/pages/mine/vehilce_list/auth_application_list/controller.dart';
import 'package:inmotion_pro/pages/mine/vehilce_list/auth_application_list/to_me/controller.dart';
import 'package:inmotion_pro/pages/mine/vehilce_list/auth_application_list/view.dart';
import 'package:inmotion_pro/pages/mine/vehilce_list/controller.dart';
import 'package:inmotion_pro/pages/mine/vehilce_list/vehilce_auth_user_list/controller.dart';
import 'package:inmotion_pro/pages/mine/vehilce_list/vehilce_auth_user_list/view.dart';
import 'package:inmotion_pro/pages/mine/vehilce_list/view.dart';
import 'package:inmotion_pro/pages/launch/root/root_binding.dart';
import 'package:inmotion_pro/pages/launch/root/view.dart';

import 'package:inmotion_pro/pages/login_register/controller.dart';
import 'package:inmotion_pro/pages/login_register/view.dart';
import 'package:inmotion_pro/service/log/controller.dart';
import 'package:inmotion_pro/service/log/view.dart';
import 'package:get/get.dart';
import '../pages/main/cycling_record_detail/controller.dart';
import '../pages/main/cycling_record_detail/view.dart';
import '../pages/main/realtime_detail/controller.dart';
import '../pages/main/realtime_detail/view.dart';
import '../pages/main/vehicle_more/vehicle_error/controller.dart';
import '../pages/main/vehicle_more/vehicle_error/view.dart';
import '../pages/main/vehicle_more/view.dart';
import '../pages/main/vehicle_more/about_vehicle/controller.dart';
import '../pages/main/vehicle_more/about_vehicle/view.dart';
import '../pages/main/vehicle_more/battery_info/controller.dart';
import '../pages/main/vehicle_more/battery_info/view.dart';
import '../pages/main/vehicle_setting/controller.dart';
import '../pages/main/vehicle_setting/view.dart';
import '../pages/mine/setting/account_security/bind_3rd_account/view.dart';
import '../pages/mine/setting/account_security/controller.dart';
import '../pages/mine/setting/account_security/verify_account/controller.dart';
import '../pages/mine/setting/account_security/verify_account/view.dart';
import '../pages/mine/setting/account_security/verify_code/controller.dart';
import '../pages/mine/setting/account_security/verify_code/view.dart';
import '../pages/mine/setting/account_security/verify_complete/controller.dart';
import '../pages/mine/setting/account_security/verify_complete/view.dart';
import '../pages/mine/setting/account_security/view.dart';
import '../pages/mine/setting/controller.dart';
import '../pages/mine/setting/view.dart';
import '../pages/main/vehicle_more/ota/controller.dart';
import '../pages/main/vehicle_more/ota/view.dart';
import '../pages/mine/vehilce_list/auth_application_list/from_me/controller.dart';
import '../pages/launch/controller.dart';
import '../pages/launch/view.dart';
import 'middleware/auth_login_middleware.dart';
import 'app_routes.dart';

class AppPages {
  static final List<GetPage> routes = [
    // 启动页
    GetPage(
      name: AppRoutes.LAUNCH,
      page: () => LaunchView(),
      binding: BindingsBuilder(() {
        Get.put(LaunchController());
      }),
      transition: Transition.noTransition,
    ),

    // 根页面
    GetPage(
      name: AppRoutes.ROOT,
      page: () => RootView(),
      binding: AppRootBinding(),
      middlewares: [
        AuthLoginMiddleware(),
      ],
      transition: Transition.zoom,
      popGesture: false,
    ),

    // 登陆/注册页
    GetPage(
      name: AppRoutes.LOGIN_REGISTER,
      page: () => LoginRegisterView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<LoginRegisterController>(() => LoginRegisterController());
      }),
      transition: Transition.downToUp,
    ),

    // 国家码选择页
    GetPage(
      name: AppRoutes.AREA_CODE,
      page: () => AreaCodeView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<AreaCodeController>(() => AreaCodeController());
      }),
      transition: Transition.downToUp,
    ),

    // 搜索车辆页
    GetPage(
      name: AppRoutes.SEARCH_VEHICLE,
      page: () => BleSearchView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<BleSearchController>(() => BleSearchController());
      }),
      middlewares: [AuthLoginMiddleware()],
      transition: Transition.downToUp,
    ),

    // 车辆设置页
    GetPage(
      name: AppRoutes.VEHICLE_SETTING,
      page: () => VehicleSettingView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<VehicleSettingController>(() => VehicleSettingController());
      }),
      middlewares: [
        AuthLoginMiddleware(),
      ],
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 车辆实时详情页
    GetPage(
      name: AppRoutes.VEHICLE_REALTIME_DETAIL,
      page: () => VehicleRealtimeDetailView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<VehicleRealtimeDetailController>(
            () => VehicleRealtimeDetailController());
      }),
      middlewares: [
        AuthLoginMiddleware(),
      ],
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 车辆故障
    GetPage(
      name: AppRoutes.VEHICLE_ERROR,
      page: () => VehicleErrorView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<VehicleErrorController>(() => VehicleErrorController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 骑行记录列表
    GetPage(
      name: AppRoutes.CYCLING_RECORD_LIST,
      page: () => CyclingRecordListView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<CyclingRecordListController>(
            () => CyclingRecordListController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 更多功能页
    GetPage(
      name: AppRoutes.VEHICLE_MORE_FEATURES,
      page: () => VehicleMoreFeaturesView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<VehicleMoreFeaturesController>(
            () => VehicleMoreFeaturesController());
      }),
      middlewares: [AuthLoginMiddleware()],
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 电池信息
    GetPage(
      name: AppRoutes.BATTERY_INFO,
      page: () => BatteryInfoView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<BatteryInfoController>(() => BatteryInfoController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 关于车辆
    GetPage(
      name: AppRoutes.ABOUT_VEHICLE,
      page: () => AboutVehicleView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<AboutVehicleController>(() => AboutVehicleController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 固件升级
    GetPage(
      name: AppRoutes.FIRMWARE_UPDATE,
      page: () => OtaView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<OtaController>(() => OtaController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // "我的"个人中心
    GetPage(
      name: AppRoutes.USER_INFO,
      page: () => UserInfoView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<UserInfoController>(() => UserInfoController());
      }),
      middlewares: [AuthLoginMiddleware()],
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // "我的"设置页
    GetPage(
      name: AppRoutes.MINE_SETTING,
      page: () => MineSettingView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<MineSettingController>(() => MineSettingController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 账号与安全
    GetPage(
      name: AppRoutes.ACCOUNT_SECURITY,
      page: () => AccountSecurityView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<AccountSecurityController>(
            () => AccountSecurityController());
      }),
      middlewares: [AuthLoginMiddleware()],
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 在线客服
    GetPage(
      name: AppRoutes.CONTACT_ONLINE_SERVICE,
      page: () => ContactOnlieServiceView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<ContactOnlieServiceController>(
            () => ContactOnlieServiceController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // App关于
    GetPage(
      name: AppRoutes.APP_ABOUT,
      page: () => AppAboutView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<AppAboutController>(() => AppAboutController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 绑定第三方账号
    GetPage(
      name: AppRoutes.BIND_ACCOUNT,
      page: () => Bind3rdAccountView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<Bind3rdAccountController>(() => Bind3rdAccountController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 验证账号
    GetPage(
      name: AppRoutes.VERIFY_ACCOUNT,
      page: () => VerifyAccountView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<VerifyAccountController>(() => VerifyAccountController());
      }),
      transition: Transition.rightToLeft,
    ),

    // 验证码验证
    GetPage(
      name: AppRoutes.VERIFY_CODE,
      page: () => VerifyCodeView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<VerifyCodeController>(() => VerifyCodeController());
      }),
      transition: Transition.rightToLeft,
    ),

    // 验证完成
    GetPage(
      name: AppRoutes.VERIFY_COMPLETE,
      page: () => VerifyCompleteView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<VerifyCompleteController>(() => VerifyCompleteController());
      }),
      transition: Transition.rightToLeft,
    ),

    // "我的"车辆列表
    GetPage(
      name: AppRoutes.VEHICLE_LIST,
      page: () => VehicleListView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<VehicleListController>(() => VehicleListController());
      }),
      middlewares: [
        AuthLoginMiddleware(),
      ],
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 车辆授权用户列表
    GetPage(
      name: AppRoutes.VEHICLE_AUTH_USER_LIST,
      page: () => VehicleAuthUserListView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<VehicleAuthUserListController>(
            () => VehicleAuthUserListController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 车辆授权申请列表
    GetPage(
      name: AppRoutes.VEHICLE_AUTH_APPLICATION_LIST,
      page: () => VehicleAuthApplicationView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<VehicleAuthApplicationController>(
            () => VehicleAuthApplicationController());
        Get.lazyPut<BindApplyFromMeController>(
            () => BindApplyFromMeController());
        Get.lazyPut<BindApplyToMeController>(() => BindApplyToMeController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 账号注销
    GetPage(
      name: AppRoutes.REMOVE_ACCOUNT,
      page: () => RemoveAccountView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<RemoveAccountController>(() => RemoveAccountController());
      }),
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 车辆日志
    GetPage(
      name: AppRoutes.VEHICLE_LOGS,
      page: () => LogsViewPage(),
      binding: BindingsBuilder(() {
        Get.lazyPut<LogsController>(() => LogsController());
      }),
      middlewares: [AuthLoginMiddleware()],
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 日志页
    GetPage(
      name: AppRoutes.APP_LOGS,
      page: () => LogsViewPage(),
      binding: BindingsBuilder(() {
        Get.lazyPut<LogsController>(() => LogsController());
      }),
      middlewares: [AuthLoginMiddleware()],
      transition: Transition.rightToLeft,
      popGesture: true,
    ),

    // 搜索常见问题页
    GetPage(
      name: AppRoutes.SEARCH_COMMON_PROBLEM,
      page: () => BleFAQView(),
      binding: BindingsBuilder(() {
        Get.lazyPut<BleFAQController>(() => BleFAQController());
      }),
      transition: Transition.downToUp,
    ),
  ];
}
